<?php 
	include ('../lib/twitese.php');
	
	if ( isset($_GET['id']) ) {
		$t = getTwitter();
		$statusid = $_GET['id'];
		$comments = $t->comments($statusid);
		$count = $t->commentCount($statusid);
		$count = $count[0]->comments;
		if (!$comments) {
			echo "empty";
			exit();
		}
		
		foreach ($comments as $comment) {
			$user = $comment->user;
			$text = formatText($comment->text);
			$date = formatDate($comment->created_at);
			$commentid = $comment->id;
			echo "
			<div class=\"comment_ctn\">
				<span class=\"comment_author\">
					<a href=\"user.php?id=$user->screen_name\" target=\"_blank\"><img src=\"$user->profile_image_url\" title=\"$user->screen_name\" /></a>
				</span>
				<span class=\"comment_body\">
					<span class=\"status_word\">
						<input type=\"hidden\" class=\"comment_id\" value=\"$commentid\" />
						<a class=\"user_name\" href=\"user.php?id=$user->screen_name\" target=\"_blank\">$user->screen_name</a> $text 
						<span class=\"comment_date\">{$date}</span>
			";
			if ($user->screen_name == getEncryptCookie('twitese_name')) {
				echo "	<a href=\"#\" class=\"comment_delete_btn\">删除</a>";
			} else {
				echo "	<a href=\"#\" class=\"comment_reply\">回复</a>";
			}
			echo "	</span>
				</span>
				<div class=\"clear\"></div>
			</div>
			";
		}
		echo "<div class=\"comment_count\"><a href=\"status.php?id=$statusid\" target=\"_blank\">查看全部评论($count)</a> <a href=\"#\" class=\"comment_close\">关闭</a> </div>";
		
	} else {
		echo "error";
	}
	
	
?>

